﻿using System;
using System.Windows;
using System.Windows.Media.Animation;

public static class Extensions
{
    public static void Begin(this FrameworkElement element, string name)
    {
        Storyboard story = ((Storyboard)element.Resources[name]);
        story.Begin();
    }

    public static void Begin(this FrameworkElement element, string name, Action completeAction)
    {
        Storyboard story = ((Storyboard)element.Resources[name]);
        story.Completed += (s, e) => completeAction();
        story.Begin();
    }
}